const express = require('express');
const session = require('express-session');
const path = require('path')
const admin = require('./routers/admin.js');

const app = new express()

//配置public目录为静态资源目录
app.use(express.static(path.join(__dirname, "publics")))
app.use('/upload', express.static(path.join(__dirname, "upload")))

//使用ejs模板引擎
app.set('view engine', 'ejs')

app.use(session({
    secret: 'keyboard cat',
    resave: false,
    saveUninitialized: true,
    cookie: {
        maxAge: 1000 * 5 * 60
    },
    rolling: true,
    /* store: new MongoStore({
        url: 'mongodb://127.0.0.1:27017/productmanage',
        touchAfter: 24 * 3600
    }) */
}))
//app.locals['userinfo'] = '123';
app.use('/admin',admin);


app.listen(3000, '127.0.0.1')